<!DOCTYPE html>
<html>
<head>
  <title>表单</title>
  {include file="public/head" /}
</head>
<body>
<div class="wrapper" >

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper" style="background: #fff">
 

    <!-- Main content -->
    <section class="content container-fluid" >

      <div class="row" >
        <div class="col-xs-12">
             <!-- form start -->
            <form id="attrForm" action="{:url('Menu/getdata')}" class="form-horizontal">
            <input type="hidden" name="menu_id" id="menuId" value="{$data.menu_id}">
            <input type="hidden" name="show_id" id="showId" value="{$data.menu_status}">
            <input type="hidden" name="type_id" id="typeId" value="{$data.menu_type}">
            <input type="hidden" name="parent_id" id="parentId" value="{$data.parent_id}">
            <input type="hidden" id="demo" name="remark" value="">
              <div class="box-body">
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-2 control-label">菜单名称</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="menu_name" value="{$data.menu_name}">
                  </div>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">上级菜单</label>
                    <div class="col-sm-10">
                        <select class="form-control select2" onPropertyChange="showValue()" id="setmenu" name="parent_menu" style="width: 100%;">
                            <option value="0">顶层</option>
                            {foreach name="list" item="menu"}
                              <option value="{$menu.menu_id}">{$menu.menu_name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">菜单类型</label>
                    <div class="col-sm-10">
                        <select class="form-control select2" name="menu_type" id="settype" style="width: 100%;">
                            <option value="0">只作为菜单</option>
                            <option value="1">有界面可访问菜单</option>
                            <option value="2">无界面可访问菜单</option>

                        </select>
                    </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">应用模块</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="model_name" value="{$data.app}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">控制器名</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="cont_name" value="{$data.controller}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">操作方法</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="action_name" value="{$data.action}">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label"><i></i>小图标</label>

                  <div class="col-sm-10">
                    <input id="open_icons" type="text" class="form-control" name="icons" value="{$data.icon}">
                  </div>
                </div>
             <!--    <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label"><i></i>备注</label>

                  <div class="col-sm-10">
                    <textarea type="text" rows="5" cols="30" class="form-control" onblur="upperCase()" id="area" value="">{$data.remark}</textarea>
                  </div>
                </div> -->
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">额外参数</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="paran" value="{$data.param}" placeholder="传参方式：参数1=值&参数2=值">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">排序</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="menu_sort" value="{$data.menu_sort}">
                  </div>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">显示/隐藏</label>
                    <div class="col-sm-10">
                        <select class="form-control select2" name="radio2" id="setshow" style="width: 100%;">
                            <option value="1">显示</option>
                            <option value="0">隐藏</option>
                            
                        </select>
                    </div>
                </div>
              </div>
            </form>
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
{include file="public/js" /}
<script type="text/javascript">
//根据需要填写需要的模块
function confirm() {
    return $("#attrForm").serialize();
} 

// function upperCase(){
//   var text =document.getElementById("area").value;
//   document.getElementById("demo").value = text;
// }

window.onload=function(){
    // upperCase();
    var parentId =document.getElementById("parentId").value;
    var optElements=document.getElementById("setmenu").children;
    var showId =document.getElementById("showId").value;
    var optshow=document.getElementById("setshow").children;
    var typeId =document.getElementById("typeId").value;
    var opttype=document.getElementById("settype").children;
    //菜单父级
    var optValue=parentId;//这是已知的值
    for(var opt in optElements){
        if(optElements[opt].value==optValue){
            optElements[opt].selected="selected";
            // return;
        }
    }
    //隐藏状态
    for(var opt in optshow){
        if(optshow[opt].value==showId){
            optshow[opt].selected="selected";
            // return;
        }
    }
    //菜单类型
    for(var opt in opttype){
        if(opttype[opt].value==typeId){
            opttype[opt].selected="selected";
            // return;
        }
    }
}
</script>
</script>
</body>
</html>